// 在这里配置代理
const { defineConfig } = require("@vue/cli-service");
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave: false,
  devServer: {
    open: true,
    host: "127.0.0.1",
    // 匹配 /api 来设置代理转发  只要匹配到/api localhost:8080会转发到
    proxy: {
      "/api": {
        target: "http://localhost:3000",
        pathRewrite: { "^/api": "" },
      },
      "/user": {
        target: "http://m.kugou.com",
        changeOrigin: true,
        pathRewrite: { "^/user": "" },
      },
      "/album": {
        target: "http://localhost:4000",
      },
    },
  },
  chainWebpack: (config) => {
    // 移除 prefetch 插件
    config.plugins.delete("prefetch");
  },
});
